<?php
/**
 * NAME: stats
 * WHEN: OnMsg
 * PROVIDES: NONE
 * AUTOLOAD: true
 * DESCRIPTION: Dane do debugu
 * VERSION: 0.1
 * UPDATE: http://update.tempaq2.blacksoft.eu/check.php
 * AUTHOR: blacksoft.eu
 */
  
 exit();

//*module_register_start
	$cmd = $module->addCommand('!stats', 'Statystyki', null, true); //, '[a-z]{2}'); (tak tez mozna)
	$module->addSubcommand($cmd, 'mem', 'zużycie pamięci', null, true);
	$module->addSubcommand($cmd, 'dumpvars', 'Dumpniecie wszystkich zmiennych na stdout lub do pliku', '[a-z\.0-9]*', true);
	
	

//*function_start
	if (count($parsed_module)) {
		foreach($parsed_module as $k=>$v) {
			$msg='';
			switch($k) {
				case 1:
					if (function_exists('memory_get_usage')) {
						$msg = 'Mem usage: '.(($mem = memory_get_usage(true))/1024).'kB.';
						if (function_exists('memory_get_peak_usage') && $mem !== $peak = memory_get_peak_usage(true))
							$msg.='   Mem peak usage: '.($peak/1024).'kB. ';
						$bot->send($msg);
					}
					break;
				case 2:
					if ($v[0]!==false) {
						$bot->debug('Dumping vars to file: '.$v[0], DBG_INFO,1);
						file_put_contents($v[0], print_r($GLOBALS,true));
					} else {
						$bot->debug('Dumping vars:', DBG_WARN, 1);
						var_dump($GLOBALS);
					}
					break;
			}
		}
	}
?>